<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
  <th:block th:include="include :: header('项目小试列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
  <div class="row">
    <div class="col-sm-12 search-collapse">
      <form id="formId">
        <div class="select-list">
          <ul>
            <li>
              项目名称：<input type="text" name="projectName"/>
            </li>
            <li>
              项目进度：
              <select name="progressCode" th:with="type=${@dict.getType('project_progress')}">
                <option value="">--所有--</option>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
              </select>
            </li>
            <li>
              污水类型：
              <select name="sewageType" th:with="type=${@dict.getType('sewage_type')}">
                <option value="">--所有--</option>
                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
              </select>
            </li>
            <li>
              <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
              <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
            </li>
          </ul>
        </div>
      </form>
    </div>
    <div class="col-sm-12 select-table table-striped">
      <table id="bootstrap-table" data-mobile-responsive="true"></table>
    </div>
  </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
  var editFlag = [[${@permission.hasPermi('project:projectTest:edit')}]];
  var sewageDatas = [[${@dict.getType('sewage_type')}]];
  var progressDatas = [[${@dict.getType('project_progress')}]];
  var prefix = ctx + "project/projectTest";

  $(function () {
    var options = {
      url: prefix + "/list",
      updateUrl: prefix + "/edit/{id}",
      detailUrl: prefix + "/detail/{id}",
      modalName: "项目小试",
      columns: [{
        checkbox: true
      },
        {
          field: 'projectId',
          title: '项目ID',
          visible: false
        },
        {
          field: 'projectName',
          title: '项目名称'
        },
        {
          field: 'progressCode',
          title: '项目进度',
          formatter: function (value, row, index) {
            return $.table.selectDictLabel(progressDatas, value);
          }
        },
        {
          field: 'sewageType',
          title: '污水类型',
          formatter: function (value, row, index) {
            return $.table.selectDictLabel(sewageDatas, value);
          }
        },
        {
          field: 'designIntake',
          title: '设计进水量(t/d)'
        },
        {
          field: 'actualIntake',
          title: '实际进水量(t/d)'
        },
        {
          field: 'projectPrice',
          title: '项目金额(元)'
        },
        {
          field: 'techPrice',
          title: '技术服务费(元)'
        },
        {
          field: 'createBy',
          title: '创建者'
        },
        {
          field: 'createTime',
          title: '创建时间'
        },
        {
          title: '操作',
          align: 'center',
          formatter: function (value, row, index) {
            var actions = [];
            if (Number(row.progressCode) >= 2) {
              actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.projectId + '\')"><i class="fa fa-edit"></i>项目小试</a> ');
              actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.projectId + '\')"><i class="fa fa-edit"></i>查看项目小试</a> ');
            }
            // if (row.progressCode == '2' || row.progressCode == '3') {
            //   actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.projectId + '\')"><i class="fa fa-edit"></i>项目小试</a> ');
            // } else {
            //   actions.push('<a class="btn btn-info btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.projectId + '\')"><i class="fa fa-edit"></i>查看项目小试</a> ');
            // }
            return actions.join('');
          }
        }]
    };
    $.table.init(options);
  });
</script>
</body>
</html>